<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户类型表</title>
</head>
<body>
<p>
    <a href="toAdd.dept">添加</a>
</p>
<table border="1" cellpadding="0" width="90%" cellspacing="0">
    <tr>
        <th>编号</th>
        <th>机构名称</th>

        <th>操作</th>
    </tr>
    <c:forEach items="${p.data}" var="d">
    <tr>
        <td>${d.id}</td>
        <td>${d.departmentname}</td>
        <td>
            <a onclick="return confirm('真的要删除码？')" href="./del.dept?id=${d.id}">删除</a>
            <a href="./toUpdate.dept?id=${d.id}">修改</a>
        </td>
    </tr>
    </c:forEach>
</table>
<p style="text-align: center">
    <a href="search.dept?pageNo=1">第一页</a>
    <c:if test="${p.pageNo>1}">
        <a href="search.dept?pageNo=${p.pageNo-1}">上一页</a>
    </c:if>
    <input style="width:40px" value="${p.pageNo}"  type="number" id="go" name="goto" min="1" max="${p.pageNums}"/>
    <input type="button" value="Go" onclick="gotoPage()"/>

    <c:if test="${p.pageNo<p.pageNums}">
        <a href="search.dept?pageNo=${p.pageNo+1}">下一页</a>
    </c:if>
    <a href="search.dept?pageNo=${p.pageNums}">最后一页</a>
</p>
<script>
    function gotoPage() {
        let p=document.getElementById("go").value;
        window.location="search.dept?pageNo="+p;
    }
</script>
</body>
</html>
